package pl.edu.agh.mguesser.ui.game;

import java.util.Map;
import javax.annotation.PostConstruct;
import javax.swing.JLabel;
import javax.swing.JPanel;
import org.springframework.stereotype.Controller;
import pl.edu.agh.mguesser.game.listener.GameStartedListener;
import pl.edu.agh.mguesser.game.listener.ScoreChangedListener;

/**
 * @author keiran
 */
@Controller
public class ScorePanel extends JPanel implements GameStartedListener,
                                                  ScoreChangedListener {

    private JLabel scoreLabel;
    
    @PostConstruct
    public void postConstruct() {
        scoreLabel = new JLabel();
        add(scoreLabel);
    }

    @Override
    public void gameStarted() {
        scoreLabel.setText("");
    }

    @Override
    public void scoreChanged(Map<String, Long> newScore) {        
        scoreLabel.setText("SCORE: " + newScore.toString());
    }

}
